Skip to content

[TT-16951] fix: plugin compiler FIPS support + goplugin tag#8012

Merged
buger merged 1 commit intorelease-5.12.1from
fix/plugin-compiler-fips-5.12.1
Apr 15, 2026
Merged

[TT-16951] fix: plugin compiler FIPS support + goplugin tag#8012
buger merged 1 commit intorelease-5.12.1from
fix/plugin-compiler-fips-5.12.1

Conversation

@buger
Copy link
Copy Markdown
Member

@buger buger commented Apr 15, 2026

Summary

  • FIPS plugin compiler: Add tykio/tyk-plugin-compiler-fips image with GOFIPS140=v1.0.0 and -tags=goplugin,ee,fips
  • goplugin tag: build.sh now always includes goplugin in build tags (was missing for EE/FIPS builds)
  • Embedded test binary: Now includes BUILD_TAG for proper validation
  • Taskfile: Update golang-cross references from 1.22 to 1.24

Plugin compiler image matrix:

Image Tags GOFIPS140
tykio/tyk-plugin-compiler goplugin -
tykio/tyk-plugin-compiler-ee goplugin,ee -
tykio/tyk-plugin-compiler-fips goplugin,ee,fips v1.0.0

Test plan

  • Verify plugin compiler CI workflow runs all 3 image builds
  • Verify FIPS image builds with correct GOFIPS140 setting
  • Verify goplugin tag is included in all plugin builds

Generated with Claude Code

- Add FIPS plugin compiler image (tykio/tyk-plugin-compiler-fips)
  with GOFIPS140=v1.0.0 and -tags=goplugin,ee,fips
- Fix build.sh to always include goplugin in build tags
- Fix embedded test binary to include BUILD_TAG
- Add GOFIPS140 ARG/ENV pass-through in Dockerfile
- Update Taskfile golang-cross references from 1.22 to 1.24

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@buger buger requested a review from a team as a code owner April 15, 2026 09:44
@probelabs
Copy link
Copy Markdown
Contributor

probelabs Bot commented Apr 15, 2026

This PR introduces support for building FIPS-compliant Go plugins and corrects the build tag configuration for all plugin types.

Files Changed Analysis

  • .github/workflows/plugin-compiler-build.yml: Adds a new workflow step to build and publish a tykio/tyk-plugin-compiler-fips Docker image. This is the main change, enabling FIPS builds by setting GOFIPS140=v1.0.0 and BUILD_TAG=ee,fips.
  • ci/images/plugin-compiler/data/build.sh: Simplifies and corrects the build command. It now ensures the goplugin build tag is always included, fixing a bug where it was omitted in EE/FIPS builds. The logic is now a single command: go build ... -tags=goplugin${BUILD_TAG:+,$BUILD_TAG}.
  • ci/images/plugin-compiler/Dockerfile: The embedded Tyk Gateway test binary is now built with the correct build tags (goplugin plus any provided BUILD_TAG). This ensures the test binary can correctly load the plugins it's intended to validate. It also adds support for the GOFIPS140 build argument.
  • Taskfile.yml: The version of the tykio/golang-cross base image is updated from 1.22 to 1.24 for local testing tasks.

Architecture & Impact Assessment

This PR enhances the Go plugin development toolchain for Tyk Gateway, with no direct changes to the gateway's core runtime. Its primary accomplishments are:

  1. Introducing FIPS Support: Provides a dedicated Docker image for compiling Go plugins in a FIPS-compliant environment.
  2. Fixing Build Tags: Corrects a flaw where the essential goplugin tag was missing from EE and FIPS plugin builds, which would cause them to fail to load.
  3. Ensuring Consistency: The embedded test binary within the compiler image is now built with the same tags as the plugins, ensuring reliable local testing.

The main affected component is the CI/CD pipeline for the plugin compiler and the development environment for users creating custom Go plugins, particularly for Enterprise and FIPS deployments.

graph TD
    subgraph "Plugin Compiler Build Matrix"
        A[Build Trigger] --> B{Edition};
        B -- Standard --> C[Image: tyk-plugin-compiler<br/>Tags: goplugin];
        B -- Enterprise --> D[Image: tyk-plugin-compiler-ee<br/>Tags: goplugin,ee];
        B -- FIPS --> E[Image: tyk-plugin-compiler-fips<br/>Tags: goplugin,ee,fips<br/>Env: GOFIPS140=v1.0.0];
    end
Loading

Scope Discovery & Context Expansion

The changes are scoped to the plugin compilation tooling. The goplugin tag is critical for the Go toolchain to produce a shared object (.so) file that the Tyk Gateway can recognize and load. By fixing its omission in certain build configurations, this PR ensures that plugins built for any edition (Standard, EE, or FIPS) are correctly structured. The update to the embedded test binary is a necessary follow-up to ensure that the testing environment within the compiler image accurately reflects the target runtime environment.

Metadata
  • Review Effort: 2 / 5
  • Primary Label: bug

Powered by Visor from Probelabs

Last updated: 2026-04-15T09:46:43.929Z | Triggered by: pr_opened | Commit: ec21214

💡 TIP: You can chat with Visor using /visor ask <your question>

@github-actions
Copy link
Copy Markdown
Contributor

API Changes

no api changes detected

@probelabs
Copy link
Copy Markdown
Contributor

probelabs Bot commented Apr 15, 2026

Security Issues (2)

Severity Location Issue
🟠 Error ci/images/plugin-compiler/Dockerfile:44
The `BUILD_TAG` build argument is used unquoted in the `go install` command, leading to a potential command injection vulnerability. A malicious value for `BUILD_TAG` (e.g., `foo; rm -rf /`) could allow arbitrary code execution during the Docker image build process. This could compromise the build environment and the source code added to the image.
💡 SuggestionEnclose the `-tags` argument in double quotes to prevent the shell from interpreting special characters in the `BUILD_TAG` variable.
🔧 Suggested Fix
    GOBIN=/usr/local/bin go install -tags="goplugin${BUILD_TAG:+,$BUILD_TAG}" -trimpath .
🟠 Error ci/images/plugin-compiler/data/build.sh:151
The `BUILD_TAG` environment variable is used unquoted in the `go build` command, leading to a potential command injection vulnerability. A user of the plugin compiler image could set a malicious `BUILD_TAG` environment variable (e.g., `foo; rm -rf /`) to execute arbitrary code inside the container. This could be used to compromise the plugin source code or other sensitive data in the container's environment.
💡 SuggestionEnclose the `-tags` argument in double quotes to prevent the shell from interpreting special characters in the `BUILD_TAG` variable.
🔧 Suggested Fix
CC=$CC CGO_ENABLED=1 GOOS=$GOOS GOARCH=$GOARCH go build -buildmode=plugin -trimpath -tags="goplugin${BUILD_TAG:+,$BUILD_TAG}" -o $plugin_name

Architecture Issues (1)

Severity Location Issue
🟡 Warning .github/workflows/plugin-compiler-build.yml:115-147
The new FIPS build job is largely a copy of the existing EE build job, leading to code duplication in the CI workflow. This approach increases maintenance overhead, as any changes to the build process will need to be replicated across all similar jobs. A more scalable and maintainable solution would be to use a matrix strategy.
💡 SuggestionRefactor the workflow to use a `strategy.matrix` to define the different build variants (e.g., standard, EE, FIPS). This would allow you to have a single, parameterized job definition that runs for each variant, eliminating code duplication and making it easier to add new variants in the future. Each matrix entry could define variables for the image name, description, build tags, and GOFIPS140 setting.

✅ Performance Check Passed

No performance issues found – changes LGTM.


Powered by Visor from Probelabs

Last updated: 2026-04-15T09:46:34.743Z | Triggered by: pr_opened | Commit: ec21214

💡 TIP: You can chat with Visor using /visor ask <your question>

@buger buger merged commit 614e724 into release-5.12.1 Apr 15, 2026
38 of 48 checks passed
@buger buger deleted the fix/plugin-compiler-fips-5.12.1 branch April 15, 2026 11:05
@buger buger changed the title fix: plugin compiler FIPS support + goplugin tag [TT-16951] fix: plugin compiler FIPS support + goplugin tag Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Jira Linter Failed

Commit: ec21214
Failed at: 2026-04-21 10:11:29 UTC

The Jira linter failed to validate your PR. Please check the error details below:

🔍 Click to view error details
failed to get Jira issue: failed to fetch Jira issue TT-16951: Issue does not exist or you do not have permission to see it.: request failed. Please analyze the request body for more details. Status code: 404

Next Steps

  • Ensure your branch name contains a valid Jira ticket ID (e.g., ABC-123)
  • Verify your PR title matches the branch's Jira ticket ID
  • Check that the Jira ticket exists and is accessible

This comment will be automatically deleted once the linter passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant